
import com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import sai.mysql.DriverLoading;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author sai
 */
public class Insurance extends HttpServlet
{
    @Override
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException
    {
        res.setContentType("text/html");
        PrintWriter out =res.getWriter();
        String patientid=req.getParameter("patientid");
        String provider=req.getParameter("iname");
        String branch=req.getParameter("branch");
        String address=req.getParameter("address");
        String ocontact=req.getParameter("ocontact");
        String aname=req.getParameter("aname");
        String acontact=req.getParameter("acontact");
        try {
            DriverLoading dl = new DriverLoading();
            String url = "insert into insurance values(?,?,?,?,?,?,?)";
           PreparedStatement st = dl.getPreparedStatement(url);
           st.setString(1,patientid);
           st.setString(2,provider);
           st.setString(3,branch);
           st.setString(4,address);
           st.setString(5,ocontact);
           st.setString(6,aname);
           st.setString(7,acontact);
           int x=st.executeUpdate();
           if(x>0)
           {
               out.println("<center><h1>success</h1></center>");
           }
           
        } catch (SQLException ex) {
            System.out.println("SQLException"+ex);
        } catch (Exception ex) {
           System.out.println("Exception"+ex);
        }
        
    }
}
